﻿@model IEnumerable<CloudFranceTriple.Models.UserProfile>

@{
    ViewBag.Title = CloudFranceTriple.WebRole.Properties.Resources.UserListTitle;
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="content-padding">
    <h1>
        @CloudFranceTriple.WebRole.Properties.Resources.UserListTitle (@Model.Where(ul => ul.ShowInNonAdminList).Count() / @Model.Count())
        <span>- </span><a href="/usermanager/role">@CloudFranceTriple.WebRole.Properties.Resources.RoleIndexTitle</a>
    </h1>
    <section>
        <table>
            <tr>
                <th>
                    @CloudFranceTriple.WebRole.Properties.Resources.LoginUserName
                </th>
                <th>@CloudFranceTriple.WebRole.Properties.Resources.SecurityRoleName</th>
                <th>@CloudFranceTriple.WebRole.Properties.Resources.LoginRegisterShowInBirthdayList</th>
                <th>@CloudFranceTriple.WebRole.Properties.Resources.LoginRegisterShowInNonAdminList</th>
                <th>@CloudFranceTriple.WebRole.Properties.Resources.LoginRegisterForumMessagePostedCounter</th>
                <th>@CloudFranceTriple.WebRole.Properties.Resources.LoginRegisterEmail</th>
                <th>@CloudFranceTriple.WebRole.Properties.Resources.LoginRegisterLastAddressIp</th>
                <th>@CloudFranceTriple.WebRole.Properties.Resources.LoginRegisterLastRequestDate</th>
                <th></th>
            </tr>

            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.UserName)
                    </td>
                    <td>
                        @String.Join("; ", Roles.GetRolesForUser(item.UserName).OrderBy(role => role))
                    </td>
                    <td>@Html.DisplayFor(modelItem => item.ShowInBirthdayList)</td>
                    <td>@Html.DisplayFor(modelItem => item.ShowInNonAdminList)</td>
                    <td>@Html.DisplayFor(modelItem => item.ForumMessagePostedCounter)</td>
                    <td>@Html.DisplayFor(modelItem => item.Email)</td>
                    <td>@Html.DisplayFor(modelItem => item.LastAddressIp)</td>
                    <td>@Html.DisplayFor(modelItem => item.LastRequestDate)</td>
                    <td>
                        @Html.ActionLink("Roles", "Index", "UserRoles", new { id = item.UserId, area = "UserManager" }, null) |
                        @Html.ActionLink(@CloudFranceTriple.WebRole.Properties.Resources.ButtonDetails, "Details", "User", new { id = item.UserId, area = "UserManager" }, null) |
                        @Html.ActionLink(@CloudFranceTriple.WebRole.Properties.Resources.ButtonEdit, "Edit", "User", new { id = item.UserId, area = "UserManager" }, null) |
                        @Html.ActionLink(@CloudFranceTriple.WebRole.Properties.Resources.ButtonDelete, "Delete", "User", new { id = item.UserId, area = "UserManager" }, null)
                    </td>
                </tr>
            }

        </table>
        @*        <br />
        @Html.ActionLink(@CloudFranceTriple.WebRole.Properties.Resources.UserRolesSetUserPostCounter, "SetUserPostCounter", "User", new { area = "UserManager" }, null)
        <br />*@
    </section>
</div>
